<template>
  <div class="cus">
    <div class="cus_box" style="width:500px;" v-loading="loading">
      <div class="title">
        <span>Add Device</span>
        <i @click="$emit('add_device_call')" class="el-icon-close"></i>
      </div>
      <div class="content">
        <el-form
          :model="dataForm"
          :rules="dataRule"
          ref="dataForm"
          label-width="auto"
        >
          <el-form-item label="Device Name" prop="adName">
            <el-input
              v-model="dataForm.adName"
              type="text"
              placeholder="Please Enter"
              clearable
            ></el-input>
          </el-form-item>

          <el-form-item label="Device Number" prop="equipmentNos">
            <el-input
              v-model="dataForm.adName"
              type="text"
              placeholder="Please Enter"
              clearable
            ></el-input>
          </el-form-item>
        </el-form>

        <div class="btns">
          <el-button @click="$emit('add_device_call')">Cancel</el-button>
          <el-button type="primary" @click="dataFormSubmit()"
            >Confirm</el-button
          >
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { isMobile } from "@/utils/validate";
export default {
  data() {
    var validateMobile = (rule, value, callback) => {
      if (!isMobile(value)) {
        callback(new Error("Phone Format Error"));
      } else {
        callback();
      }
    };
    return {
      loading: false,
      fileList: [],
      src: "",
      dataForm: {
        adName: "",
        type: "",
        times: "",
        url: "",
        equipmentNos: ""
      },
      equipmentNos_list: [],
      longitude: "",
      latitude: "",
      dataRule: {
        adName: [{ required: true, message: "Please Enter", trigger: "blur" }],
        type: [{ required: true, message: "Please Upload", trigger: "blur" }],
        equipmentNos: [
          { required: true, message: "Please Select", trigger: "blur" }
        ]
      }
    };
  },
  computed: {},
  components: {},
  props: ["res"],

  methods: {
    // Form Submit
    dataFormSubmit() {
      this.$refs["dataForm"].validate(valid => {
        if (valid) {
        }
      });
    }
  }
};
</script>
<style scoped lang="scss"></style>
